﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using YJKRevitCode.ElmentSearchUtility.LinkDocumentSuite;
using SectionSignAndFilled.StairsRoomSection.DataDefine;
using SectionSignAndFilled.StairsRoomSection.Kit;

namespace SectionSignAndFilled.StairsRoomSection.SignElems
{
	public class GridComparision : IComparer<BaseLinkDocumentResultBean>
	{
		public GridComparision(SectionViewData ViewData)
		{
			this.m_ViewData = ViewData.clone();
		}

		int IComparer<BaseLinkDocumentResultBean>.Compare(BaseLinkDocumentResultBean x, BaseLinkDocumentResultBean y)
		{
			XYZ minPt = this.m_ViewData.MinPt;
			Curve gridCurveOnView = SignCommon.GetGridCurveOnView(x, this.m_ViewData);
			if (gridCurveOnView == null)
			{
				return 0;
			}
			Curve gridCurveOnView2 = SignCommon.GetGridCurveOnView(y, this.m_ViewData);
			if (gridCurveOnView2 == null)
			{
				return 0;
			}
			double num = gridCurveOnView.Distance(minPt);
			double num2 = gridCurveOnView2.Distance(minPt);
			if (num > num2)
			{
				return 1;
			}
			return -1;
		}

		private SectionViewData m_ViewData;
	}
}
